package com.weipai.springboot.module.dao.impl;

import com.weipai.springboot.model.Shop;
import com.weipai.springboot.model.ShopCategory;
import com.weipai.springboot.model.api.Response;
import com.weipai.springboot.module.dao.ShopDao;
import com.weipai.springboot.module.mapper.ShopMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Author: 曹朋飞
 * @Date: 2018/08/27 14:23
 */
@Repository
public class ShopDaoImpl implements ShopDao{
    
    @Autowired
    ShopMapper shopMapper;

    //通过id查询店铺的详情
    @Override
    public  Shop getShopById(String shopId) {
        return shopMapper.getShopById(shopId);
    }

    //修改
    @Override
    public int updateByPrimaryKey(Shop shop) {
        return shopMapper.updateByPrimaryKey(shop);
    }

    //查询未删除/已删除的数据
    @Override
    public List<Shop> selectAllByShopDel(int del, String search, String sort, String way, Integer applicantStatus) {
        return shopMapper.selectAllByShopDel(del,search,sort,way, applicantStatus);
    }

    //批量删除
    @Override
    public int batchDeleteById(String[] id) {
        return shopMapper.batchDeleteById(id);
    }

    //绑定手机号
    @Override
    public int updateMobile(String shopId, String mobile) {
        return shopMapper.updateMobile(shopId,mobile);
    }

    //修改店铺邮箱
    @Override
    public int updateEmail(String shopId, String email) {
        return shopMapper.updateEmail(shopId,email);
    }

    //查询店铺信息：关注人数、店铺名称、logo
    @Override
    public Map<String, Object> getShopHeaderInfoByShopId(String shopId) {
        return shopMapper.getShopHeaderInfoByShopId(shopId);
    }

    //通过用户id查询店铺
    @Override
    public Shop getShopByCustomerId(String customerId) {
        return shopMapper.getShopByCustomerId(customerId);
    }

    @Override
    public List<Map<String, Object>> getShopStatement(int start, Integer end) {
        return shopMapper.getShopStatement(start, end);
    }

    @Override
    public int getShopStatementAmount() {
        return shopMapper.getShopStatementAmount();
    }

    @Override
    public Map<String, Object> getShopByIdAndMap(String shopId) {
        return shopMapper.getShopByIdAndMap(shopId);
    }

    @Override
    public int updateByPrimaryKeySelective(Shop shop) {
        return shopMapper.updateByPrimaryKeySelective(shop);
    }

    //更改客户的未结算值和已结算值
    @Override
    public int changeWithdrawal(String shopId, String noWithdrawal, String haveWithdrawal) {
        return shopMapper.changeWithdrawal(shopId, noWithdrawal, haveWithdrawal);
    }

    //更新商品的未结算金额
    @Override
    public int updateNoWithdrawal(String shopId, int allProfit) {
        return shopMapper.updateNoWithdrawal(shopId, allProfit);
    }

}
